#!/bin/bash -ex

KOALA_PANDA_DIR="/home/aleks/repos/idlize/external/incremental/tools/panda"

LOCAL_PANDA_PATH="${1}"

if [[ -z "${LOCAL_PANDA_PATH}" ]]
then
  echo "Will be installed fresh package from repo"
  LOCAL_PANDA_PATH="@panda/sdk@next"
else
  LOCAL_PANDA_PATH="$(realpath ${LOCAL_PANDA_PATH})"
  echo "Will be installed local panda: ${LOCAL_PANDA_PATH}"
fi

cd ${KOALA_PANDA_DIR}

npm rm --no-save @panda/sdk
npm i --no-save "${LOCAL_PANDA_PATH}"

npm list @panda/sdk
